from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, LogInfo
from launch_ros.actions import Node

def generate_launch_description():
    return LaunchDescription([
        DeclareLaunchArgument('use_sim_time', default_value='false'),
        
        Node(
            package='cartographer_ros',
            executable='cartographer_node',
            name='cartographer_node',
            output='screen',
            parameters=[{'use_sim_time': False}],
            arguments=[
                '-configuration_directory', '/home/mt/ros2_ws/src/reflector_slam_system/config',
                '-configuration_basename', 'trajectory_builder_2d.lua'
            ],
            remappings=[('/scan', '/cx/cloud')]
        ),
        
        # Adding the LiDAR sensor node here
        Node(
            package='lslidar_driver',
            executable='lslidar_driver_node',
            name='lslidar_driver_node',
            output='screen',
            parameters=[{'sensor_topic': '/cx/cloud'}]
        ),
    ])
